<template>
    <div class="g-height100 g-width100" v-loading="loading">
        <template v-for="(item,index) in data">
            <el-button :loading="itemLoading['loading' + index]" :key="item.id" @click="$_startProcessMixin_startProcess(item.id,(l)=>{$set(itemLoading,'loading' + index,l)})">
                {{item.name}}
            </el-button>
        </template>

    </div>
</template>

<script>
    import startProcessMixin from '../../components/canstartprocess/StartProcessMixin.js'
    export default {
        mixins: [startProcessMixin],
        name: "StartProcessPage",
        data(){
            return {
                loading: false,
                data: [],
                itemLoading:{}
            }
        },
        mounted(){
            this.initData()
        },
        methods:{
            initData(){
                this.loading = true
                this.axios.get(this.$baseURL.workflow + '/workflow/canstartprocess/list').then((res)=>{
                    this.data = res.data
                }).catch(error=>{
                    if(error.response){
                        this.$message.error(error.response.data.msg)
                    }else {
                        this.$message.error('网络错误或服务不可用')
                    }
                })
                    .finally(()=>{
                    this.loading = false
                })
            }
        }
    }
</script>

<style scoped>

</style>